package com.ky.facescan.base;


import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.gyf.immersionbar.ImmersionBar;
import com.ky.facescan.R;


public abstract class BaseActivity extends AppCompatActivity {
    protected ImmersionBar mImmersionBar;


    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mImmersionBar = ImmersionBar.with(this);
        mImmersionBar.statusBarDarkFont(true, 0.2f).statusBarColor(R.color.transparent).init();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mImmersionBar != null) {
            mImmersionBar.reset();
        }
    }

    /**
     * 设置状态栏字体是否深色
     *
     * @param isDarkFont
     */
    public void setStatusBarDarkFont(boolean isDarkFont) {
        try {
            mImmersionBar.statusBarDarkFont(isDarkFont, 0.2f).init();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
